import codecs
import sys

input_path = sys.argv[1]
result_path = input_path + '.for2input'

lines = codecs.open(input_path, 'r', encoding='utf8').readlines()
converted = []
for line in lines:
    line = line.strip().replace('<SEP>', '<S>')
    line = line + ' <SEP>'
    converted.append(line)

with codecs.open(result_path, 'w', encoding='utf8') as fout:
    fout.write('\n'.join(converted))
    fout.write('\n')